<%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>

    <head>
        <title>业主注册</title>
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
        <style>
            body {
                background-color: #f8f9fa;
                padding: 2rem 0;
            }

            .register-container {
                background: white;
                padding: 2rem;
                border-radius: 10px;
                box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
                max-width: 600px;
                margin: 0 auto;
            }
        </style>
    </head>

    <body>
        <div class="container">
            <div class="register-container">
                <h2 class="text-center mb-4">业主注册</h2>
                <form action="register" method="post">
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label class="form-label">用户名</label>
                            <input type="text" class="form-control" name="username" required>
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">密码</label>
                            <input type="password" class="form-control" name="password" required>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label class="form-label">姓名</label>
                            <input type="text" class="form-control" name="name" required>
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">手机号</label>
                            <input type="text" class="form-control" name="phone" required>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-4 mb-3">
                            <label class="form-label">楼号</label>
                            <input type="text" class="form-control" name="building" required>
                        </div>
                        <div class="col-md-4 mb-3">
                            <label class="form-label">单元号</label>
                            <input type="text" class="form-control" name="unit" required>
                        </div>
                        <div class="col-md-4 mb-3">
                            <label class="form-label">房号</label>
                            <input type="text" class="form-control" name="room" required>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label class="form-label">类型</label>
                            <select class="form-select" name="type" required>
                                <option value="户主">户主</option>
                                <option value="租户">租户</option>
                            </select>
                        </div>
                        <div class="col-md-6 mb-3">
                            <label class="form-label">车牌号（选填）</label>
                            <input type="text" class="form-control" name="plateNumber">
                        </div>
                    </div>
                    <div class="d-grid gap-2">
                        <button type="submit" class="btn btn-primary">注册</button>
                        <a href="login.jsp" class="btn btn-secondary">返回登录</a>
                    </div>
                </form>
                <% if(request.getAttribute("error") !=null) { %>
                    <div class="alert alert-danger mt-3">
                        <%= request.getAttribute("error") %>
                    </div>
                    <% } %>
            </div>
        </div>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    </body>

    </html>